<?php

namespace app\admin\controller\auth;

use app\common\controller\Backend;
use Think\Db;
/**
 * 消息
 *
 * @icon fa fa-circle-o
 */
class Message extends Backend
{
    
    /**
     * Message模型对象
     */
    protected $model = null;
    protected $noNeedRight = ['index'];
    public function _initialize()
    {
        parent::_initialize();
        $this->model = model('Message');
        $this->view->assign("messageTypeList", $this->model->getMessageTypeList());
    }
     /**
     * 查看
     */
    public function index()
    {   
        $id = $this->request->get("id");
        if($id)
        {   $where['message.id'] = $id;
            $message = Db::table("message")
                        ->join("admin","admin.id = message.admin_id")
                        ->where($where)
                        ->field("admin.nickname,message.*")
                        ->find();
            $data['is_read'] = 1;
            Db::table("message")
                        ->where($where)
                        ->update($data);
            $this->view->assign("message",$message);
        }
        return $this->view->fetch();
      
      
    }

}